home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 425_01 / tar / percent.c < prev    next >
Text File  |  1980-07-23  |  340b  |  16 lines

  1. /* This is part of the Tar program */
  2. #include <stdio.h>
  3.  
  4. void percent(curr, size)
  5. long curr, size;
  6. {
  7.    static ratio = -1;
  8.    register r1;
  9.  
  10.    r1 = (short)(size>21474836L ? curr/(size/100) : (100*curr)/size);
  11.    if (r1 != ratio) {
  12.       (void)fprintf(stderr, "%3d%%\b\b\b\b", ratio=r1);
  13.       (void)fflush (stderr);
  14.    }
  15. }
  16.